# -*- coding: utf-8 -*- 
# @project : 《Atcoder》
# @Author : created by bensonrachel on 2021/8/5
# @File : （step5）A. K-th Number in the Union of Segments（CF）.py

# https://codeforces.com/edu/course/2/lesson/6/5/practice/contest/285084/problem/A
def check(n,mid,char):
    cnt = 0
    for i in char:
        if(mid>i[0]):
            cnt += min(i[1]+1,mid)-i[0]
    return cnt
def bi(n,k,char):
    l = -2*10**9-1
    r = 2*10**9+1
    while(l+1<r):
        mid = (l+r)//2
        if(check(n,mid,char)<=k):
            l = mid
        else:
            r = mid
    return l
if __name__ == "__main__":
    n,k = map(int ,input().split())
    char = []
    for _ in range(n):
        rate = [int(i) for i in input().split()]
        char.append(rate)
    print(bi(n,k,char))

"""
左二分：
check函数是：遍历每一个区间，找出小于当前数的元素的个数和
k-th是从0开始。所以前面有k个
"""